package com.myjunjie.blog.service.impl;


import com.google.gson.JsonObject;
import com.myjunjie.blog.dao.IArticleDao;
import com.myjunjie.blog.dao.impl.ArticleDaoImpl;
import com.myjunjie.blog.entity.Article;
import com.myjunjie.blog.service.IArticleService;

public class ArticleServiceImpl implements IArticleService {

	/**
	 * 增加文章
	 */
	public boolean addArticle(Article article) {

		IArticleDao articleDao = new ArticleDaoImpl();
		return articleDao.addArticle(article);

	}

	/**
	 * 删除文章
	 */
	public boolean deleArticleById(Article article) {

		IArticleDao articleDao = new ArticleDaoImpl();
		return articleDao.deleArticleById(article);
	}

	/**
	 * 更新文章
	 */
	public boolean upateArticle(Article article) {

		IArticleDao articleDao = new ArticleDaoImpl();
		return articleDao.upateArticle(article);
	}

	/**
	 * 获取文章信息
	 */
	public JsonObject getList(String startNum, String counted) {
		IArticleDao articleDao = new ArticleDaoImpl();

		return articleDao.getList(startNum, counted);
	}


	/**
	 * 根据id获取文章
	 */
	public JsonObject getArticleById(String id) {
		IArticleDao articleDao = new ArticleDaoImpl();

		return articleDao.getArticleById(id);
	}
	
	/**
	 * 按分类获取文章信息
	 */
	public JsonObject getListByCategory(String category, String strartNum, String counted) {
		IArticleDao articleDao = new ArticleDaoImpl();
		return articleDao.getListByCategory(category, strartNum, counted);
	}

	/**
	 * 获取所有分类
	 */
	public JsonObject getCategory() {
		IArticleDao articleDao = new ArticleDaoImpl();
		return articleDao.getCategory();
	}


}
